/*

Rand test  : random testing council room card

card effect: add 4 cards and 1 buy after the card

// pre con: rand num cards on hand, rand buy avaliable
// post con: the card increase by 3 and buy increase by 2

*/


#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1



int main() {
    int idx=0;
    int test = 1000;
    int seed = 1000;
    int numPlayer = 2;
    int r;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;

    while (test){

    memset(&G, 23, sizeof(struct gameState));   // clear the game state
    r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
    int randidx1=rand()%1000;
    int idxhpr1= randidx1;
    while(idxhpr1>0){
       Actionplus(&G);
       idxhpr1--;
    }

    int randidx2=rand()%1000;
    int idxhpr2= randidx2;
    while(idxhpr2>0){
       cardplus(&G);
       idxhpr2--;
    }
    int a= A(&G);
    int b= B(&G);
    printf("expecting to see: action- %d card count- %d\n", A(&G), B(&G)+3);
    cardEffect(council_room, 0,0,0,&G,0,0);
    printf("          result: action- %d card count- %d\n", A(&G), B(&G));
    
    if(a != A(&G) ){
     idx = 99;
     printf("action error!at test number %d \n", test);
     exit(0);
    }
    if(b != B(&G)-3 ){
     idx = 99;
     printf("card count error! at test number %d \n", test);
     exit(0);
    }
    test--;
    }

    printf("test passed!");
    return 0;
}
